﻿using MailKit.Net.Smtp;
using PMS.Core.Configuration.CommonEnumConfigs;
using PMS.Data.Entities.Messages;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;

namespace PMS.Services.Utils.Messages
{
    /// <summary>
    /// SMTP Builder
    /// </summary>
    public interface ISmtpBuilder
    {
        /// <summary>
        /// Create a new SMTP client for a specific email account
        /// </summary>
        /// <param name="emailAccount">Email account to use</param>
        /// <returns>An SMTP client that can be used to send email messages</returns>
        SmtpClient Build(EmailAccount emailAccount);

        /// <summary>
        /// Verifies the remote Secure Sockets Layer (SSL) certificate used for authentication.
        /// </summary>
        /// <param name="sender">An object that contains state information for this validation.</param>
        /// <param name="certificate">The certificate used to authenticate the remote party.</param>
        /// <param name="chain">The chain of certificate authorities associated with the remote certificate.</param>
        /// <param name="sslPolicyErrors">One or more errors associated with the remote certificate.</param>
        /// <returns>A System.Boolean value that determines whether the specified certificate is accepted for authentication</returns>
        bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors);
    }

}
